package com.huoxingy.statics.repo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by lihu on 2018/1/11.
 */
@Service
public class DailyMemberLostRepoImpl implements DailyMemberLostRepo {

    @Autowired
    JdbcTemplate jdbcTemplate;

    @Override
    public Long getLossMember(String storeId, String bizDate) {
        String sql = "SELECT count(*) from daily_member_lost WHERE store_id=? and biz_date=? and is_lost=1";
        return jdbcTemplate.queryForObject(sql, Long.class, storeId, bizDate);
    }

    @Override
    public List<Map<String, Object>> getMemberIds(String storeId, String bizDate) {
        String sql = "SELECT member_id memberId from daily_member_lost WHERE store_id=? and biz_date=? and is_lost=1";
        return jdbcTemplate.queryForList(sql, storeId, bizDate);
    }
}
